using UnityEngine;

namespace NL.Advanced
{
    public class UICanvas : _OwnerOf<Canvas>
    {
        public Camera Camera;
        public string CameraName;
        // Start is called before the first frame update


        void Start()
        {
            if (_Owner == null) return;

            if (!string.IsNullOrEmpty(CameraName))
            {
                var w = UICamera.INSTANCE_Of(CameraName);
                if (w != null)
                {
                    // _Owner.renderMode = RenderMode.ScreenSpaceCamera;
                    _Owner.worldCamera = w.Owner;
                }
            }

            if (Camera != null)
            {

                // _Owner.renderMode = RenderMode.ScreenSpaceCamera;
                _Owner.worldCamera = Camera;

            }


        }
    }
}

